package com.qf.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.mapper.DtsAddressMapper;
import com.qf.pojo.DtsAccountTrace;
import com.qf.pojo.DtsAddress;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class DtsAddressServiceImpl implements DtsAddressService{
    @Autowired
    private DtsAddressMapper dtsAddressMapper;
    @Override
    public int count() {
        return dtsAddressMapper.selectCount(null);
    }

    @Override
    public List<DtsAddress> find(int page, int limit, String sort, String order) {
        //自定义分页对象
        IPage<DtsAddress> dtsAddressIPage =
                dtsAddressMapper.selectPage(new Page<DtsAddress>(page,limit),
                        new QueryWrapper<DtsAddress>());
        //根据那个属性排序
        //升序还是降序
        List<DtsAddress> dtsAddressList = dtsAddressIPage.getRecords();
        return dtsAddressList;
    }
}
